/*
 * Copyright (c) 2001-2007, TIBCO Software Inc.
 * Use, modification, and distribution subject to terms of license.
 */
jsx3.require("jsx3.xml.Cacheable");jsx3.Class.defineClass("jsx3.gui.CDF",jsx3.app.Model,[jsx3.xml.CDF,jsx3.xml.Cacheable],function(m,p){var
ub={d:"; value to be shown (read): ",a:"Component: ",c:"']/@",f:"jsx3.gui.Form",b:"; XPath: //record[@jsxid='",e:""};var
O=jsx3.util.Logger.getLogger(m.jsxclass.getName());p.init=function(i){this.jsxsuper(i);};p.redrawRecord=function(e,c){this.read(null,e);};p.Sw=function(a){var
L=this.jsxcdfid;if(jsx3.util.strEmpty(L))this.findAncestor(function(k){if(!jsx3.util.strEmpty(k.jsxcdfid)){L=k.jsxcdfid;return true;}},false);var
db=[];m.Pw(this,L,db,a);return db;};m.Pw=function(g,q,r,c){var
oa=g.getChildren();for(var
Wa=0;Wa<oa.length;Wa++){var
ma=oa[Wa];if(ma instanceof m&&!(jsx3.util.strEmpty(ma.jsxxmlid)&&jsx3.util.strEmpty(ma.jsxxmlurl)&&jsx3.util.strEmpty(ma.jsxxml)))continue;if(ma.jsxcdfid)q=ma.jsxcdfid;if(!jsx3.util.strEmpty(ma.jsxcdfattribute)&&!jsx3.util.strEmpty(q)&&(!c||c==q)){O.trace(ub.a+ma+ub.b+q+ub.c+ma.jsxcdfattribute);r.push({target:ma,jsxcdfid:q,jsxcdfattribute:ma.jsxcdfattribute});}m.Pw(ma,q,r,c);}};p.paint=function(){this.Ok(0,this.getXML());return this.paintChildren();};p.repaint=function(){this.read(false);return this.getParent().repaint();};p.onXmlBinding=function(f){this.jsxsupermix(f);this.read();};p.read=function(l,q){if(l!==false)l=true;var
ra=this.Sw(q);var
cb=this;if(jsx3.util.strEmpty(this.jsxxmlid)&&jsx3.util.strEmpty(this.jsxxmlurl)&&jsx3.util.strEmpty(this.jsxxml))cb=this.findAncestor(function(j){return !(jsx3.util.strEmpty(j.jsxxmlid)&&jsx3.util.strEmpty(j.jsxxmlurl)&&jsx3.util.strEmpty(j.jsxxml));},false);for(var
Q=0;Q<ra.length;Q++){var
Eb=cb.getRecordNode(ra[Q].jsxcdfid);var
Lb=ra[Q].target;var
ob;if(Eb)ob=Eb.getAttribute(ra[Q].jsxcdfattribute);O.trace(ub.a+Lb+ub.d+ob+ub.e);if(Lb.instanceOf(ub.f)){Lb.setValue(ob);}else{if(!ob)ob=ub.e;Lb.setText(ob,l);}}};p.write=function(){var
Ua=this.Sw();for(var
F=0;F<Ua.length;F++){var
Aa=this.getRecordNode(Ua[F].jsxcdfid);if(Aa){var
wa=Ua[F].target;var
jb=wa.instanceOf(ub.f)?wa.getValue():wa.getText();if(!jb)Aa.removeAttribute(Ua[F].jsxcdfattribute);else Aa.setAttribute(Ua[F].jsxcdfattribute,jb);}}};p.setCDFId=function(k){this.jsxcdfid=k;this.read();};p.getCDFId=function(){return this.jsxcdfid;};});
